package com.guo.fristspringboot.controller;

import com.guo.fristspringboot.entity.Book;
import com.guo.fristspringboot.mapper.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/book")
public class BookController {

    @Autowired
    private BookMapper bookMapper;

    @RequestMapping("/getAll")
    public List<Book> getAll(){
        return bookMapper.getAll();
    }

    @RequestMapping("/getById")
    public Book getById(){
        Book b=bookMapper.getById("1");
        System.out.println(b.toString());
        return bookMapper.getById("1");
//        一行文字
    }
}
